home *** CD-ROM | disk | FTP | other *** search
/ Ian & Stuart's Australian Mac 1993 September / September 93.iso / Archives / Utilities / System / System Utilities / Shells / MacShell Demo / examples < prev    next >
Encoding:
Text File  |  1991-06-15  |  9.0 KB  |  359 lines  |  [TEXT/sBAY]

  1. #    MacShell command examples
  2. #
  3. #    Copyright (c) 1989, 1990 Suick Bay Technologies.  All rights reserved.
  4. #    
  5. #    P.O. Box 29202
  6. #    Mpls, MN 55429
  7. #    
  8. #    No parts of this software may be reproduced or stored in a
  9. #    retrieval system or transmitted in any form, or any means,
  10. #    electronic, mechanical, photocopying, recording or otherwise,
  11. #    without the prior written permission of Suick Bay Technologies.
  12. #    
  13. #    Spread the word and not the disk.
  14. #
  15. ############    MacShell™ UNIX Commands ############
  16. #
  17. #    alias        - define command alias 
  18. #
  19. alias dir=ls            # make life easier for MS-DOS users
  20. alias dir                # print alias dir
  21. alias vi=edit            # make life easier for UNIX users
  22. alias chmod=setfile
  23. alias                    # print all alias's
  24. #
  25. #    cal            - print calendar
  26. #
  27. cal                        # current month
  28. cal    2000                # year 2000
  29. cal    8 2000                # august 2000
  30. #
  31. #    cat            - catenate and print files and/or standard input
  32. #
  33. cat    ,profile            # print contents of .profile to shell output
  34. cat    -                    # print stdin to stdout
  35. #
  36. #    cd            - change directories
  37. #
  38. cd /                    # move to root
  39. cd -d                    # use dialog to set directory
  40. cd -i 2                    # move to directory number 2 (root)
  41. #
  42. #    cmp            - compare files
  43. #
  44. cmp    file1 file2            # compare files for differences
  45. #
  46. #    cp            - copy files in one of two formats
  47. #
  48. cp        *.c    backup        # copy C source files to backup directory
  49. cp        myfile /back    # copy myfile to a backup at the root
  50. #
  51. #    crypt         - encode files
  52. #
  53. crypt     myfile            # encrypt myfile, prompt for password
  54. crypt     myfile    -p me    # encrypt myfile, use 'me' as password
  55. crypt     myfile    -s        # encrypt myfile in place
  56.  
  57. #
  58. #    decrypt     - decode files
  59. #
  60. decrypt     myfile            # decrypt myfile, prompt for password
  61. decrypt     myfile    -p me    # decrypt myfile, use 'me' as password
  62. decrypt     myfile    -s        # decrypt myfile in place
  63. #
  64. #    date        - print time and date
  65. #
  66. date                    # print date and time
  67. #
  68. #    df            - show disk (volume) free space
  69. #
  70. df                        # print disk info
  71. #
  72. #    diff        - differential file compare
  73. #
  74. diff    file1 file2        # print character differences between files
  75. diff    file1 file2 -h    # print all differences between files
  76. #
  77. #    echo        - echo arguments to stdout
  78. #
  79. echo free space is $FREEMEM    # print heap memory remaining
  80. #
  81. #    find        - find files
  82. #
  83. find    * -t APPL        # find all applications on line.
  84. find * -t APPL -c sBAY    # find MacShell application
  85. find *.c                # find all C source code
  86. #
  87. #    fgrep        - search files for strings
  88. #
  89. fgrep long …/*.c        # look for 'long' string in all C source files
  90. fgrep -h me  *            # look for 'me' in all text files, don't print headers
  91. #
  92. #    grep        - search files for patterns
  93. #
  94. grep    ?int* …/*.c        # look for lines that contain the pattern '?int*'
  95. #
  96. #    hd            - dump files in hex
  97. #
  98. hd myfile                # print the contents of myfile in a HEX/ASCII format
  99. hd -n myfile            # print the contents of myfile in a HEX format
  100. hd -r myfile            # print the contents of myfile resource fork
  101. #
  102. #    ls            - list files and directories
  103. #
  104. ls                        # list present directory
  105. ls /                    # list root directory
  106. ls //Untitled            # list root of volume 'Untitled'
  107. ls -l                     # list present directory in long format
  108. ls -d                    # list directories in present directory
  109. #
  110. #    man            - prints detailed explanation of a commands function
  111. #
  112. man commands            # list manual for commands
  113. man                        # list man command information
  114. #
  115. #    mkdir        - make directories
  116. #
  117. mkdir     newdir            # make a directory 'newdir'
  118. #
  119. #    mv            - move files in one of two formats
  120. #
  121. mv myfile myfile.bak    # rename 'myfile' to 'myfile.bak'
  122. mv *.c /backups            # move C source files to '/backup' directory
  123. #
  124. #    pr            - print text files
  125. #
  126. pr *                    # print all TEXT files in present directory
  127. pr …/*.c -2js            # print C source in two columns, use Job and SetUp dialogs
  128. pr …/*.c -3ls            # print in three column landscape mode, use SetUp dialog
  129. pr * -h                    # suppress headers from prints
  130. #
  131. #    pwd         - print present working directory path
  132. #
  133. pwd                        # print present working directory
  134. #
  135. #    rm            - remove files
  136. #    
  137. rm    *.c.bak                # remove all files with '.c.bak' suffix
  138. rm 'My Folder' -r        # recursively delete all files and folders in and including 'My Folder'
  139. #
  140. #    rmdir        - remove directories
  141. #
  142. rmdir     'My Folder'    # remove empty folder 'My Folder'
  143. rmdir     -f 'My Folder'    # remove non-empty folder 'My Folder'
  144. #
  145. #    set            - set shell variables
  146. #
  147. set TODAY=MONDAY        # set a shell variable
  148. set                        # print all shell variables
  149. #
  150. #    script        - run shell script
  151. #
  152. script    myscript        # run myscript
  153. script    myscript -v        # run myscript in verbose mode
  154. myscript                # run myscript
  155. myscript -v                # run myscript in verbose mode
  156. #
  157. #    size        - print the size of data and resource forks
  158. #
  159. size    myfile            # print the size of resource and data forks of 'myfile'
  160. #
  161. #    sh            - open a new shell
  162. #
  163. sh                        # open a new shell window
  164. #
  165. #    sleep        - suspend execution for an interval (Ticks)
  166. #
  167. sleep 360                # sleep for 6 seconds
  168. #
  169. #    touch        - update the date last modified of files
  170. #
  171. touch …/*                # update modification date of all files in a current tree
  172. #
  173. #    tr            - translate characters
  174. #
  175. tr    [a-Z] [A-Z]            # convert all stdin from lowercase to uppercase
  176. #
  177. #    unalias        - undefine command alias 
  178. #
  179. unalias dir                # who needs MS-DOS anyway !
  180. #
  181. #    unset        - unset (remove) shell variables
  182. #
  183. unset TODAY                # remove shell variable
  184. #
  185. #    usage        - prints a one line explanation of a commands function
  186. #
  187. usage unalias            # print simple explanation of unalias command
  188. #
  189. #    wc            - count characters, words, and lines in text files
  190. #
  191. wc *.h                    # print counts of header files
  192. #
  193. ############    MacShell™ UNIX Extensions ############
  194. #
  195. #    cpt            - copy directories (trees)
  196. #
  197. cpt mysrc mybak            # copy directory mysrc to mybak
  198. #
  199. #    mvt            - move directories (trees)
  200. #
  201. cpt mysrc mybak            # rename directory mysrc to mybak
  202. cpt mysrc /mybak        # move directory mysrc to /mybak
  203. #
  204. #    edit        - edit text files
  205. #
  206. edit //*/…/*.pas        # edit all pascal files online
  207. #
  208. #    read         - read text files
  209. #
  210. read doc                # read file 'doc'
  211. #
  212. #
  213. ############    MacShell™ Macintosh Commands ############
  214. #
  215. #    about         - open about dialog
  216. #
  217. about                    # display about MacShell dialog
  218. #
  219. #    addmenu        - add or modify a menu
  220. #
  221. addmenu Help                # add the menu 'Help'
  222. addmenu Help General        # add the item 'General' to 'Help' menu
  223. addmenu Help General man    # add the command 'man' to the item 'General' in the 'Help' menu
  224. addmenu    Help Items            # add 'Items' menu item
  225. #
  226. #    addsubmenu    - add a hierarchical menu
  227. #
  228. addmenu    Help Items    submenu Item1    # add submenu to Items, with submenu item Item1
  229. #
  230. #    clear        - erase all shell output
  231. #
  232. clear                    # erase all output in current shell
  233. #
  234. #    close        - close text window
  235. #
  236. close *.h                # close all C header windows
  237. #
  238. #    delmenu        - remove menu and/or menu items
  239. #
  240. delmenu Help    Items    # delete the 'Items' item from the 'Help' menu
  241. delmenu Help            # delete the 'Help' menu
  242. #
  243. #    eject        - eject and unmount volume
  244. #
  245. eject     Floppy            # eject the volume 'Floppy'
  246. eject -u Floppy            # eject the volume 'Floppy' and unmount it.
  247. #
  248. #    lsr            - list resources
  249. #
  250. lsr MacShell -t DLOG    # list DLOG resources in MacShell
  251. #
  252. #    new            - open a new shell or edit window (see prefs)
  253. #
  254. new                        # what more can it say ?
  255. #
  256. #    open        - open text files for editing
  257. #
  258. open                    # use open dialog to open files
  259. open …/*.h                # open all C header files in tree
  260. #
  261. #    pagesetup    - open page setup dialog
  262. #
  263. pagesetup                # open PageSetUp dialog
  264. #
  265. #    play        - play sound files and resources
  266. #
  267. play                    # play the current beep sound
  268. play //*/…/* -v            # play all sounds online, list their file and resource ID
  269. play myfile -i 200        # play 'snd ' resource 200 in myfile
  270. #
  271. #    prefs        - set MacShell preferences
  272. #
  273. prefs                    # use dialog to set MacShell preferences
  274. prefs -i                # make MacShell case sensitive 
  275. prefs -c KAHL            # make TEXT files THINK C files by default
  276. #
  277. #    print        - open print job dialog
  278. #
  279. print                    # open Print Job dialog
  280. #
  281. #    quit        - quit MacShell™
  282. #
  283. quit                    # cause MacShell to quit
  284. #
  285. #    restart        - restart the Macintosh
  286. #
  287. restart                    # call Mac shutdown manager with restart request
  288. #
  289. #    revert        - revert text window to last version saved.
  290. #
  291. revert    mywindow        # revert contents of window 'mywindow'
  292. #
  293. #    save        - save the contents of window to file
  294. #
  295. save *.c                # save the contents of all open C source windows
  296. #
  297. #    saveas        - save the contents of window to new file
  298. #
  299. saveas *.h                # prompt user to save header files under new names
  300. #
  301. #    setfile        - set file attributes
  302. #
  303. setfile    *.crypt    -V        # make all encrypted files invisible
  304. setfile backup/* -L        # lock all files in backup directory
  305. setfile …/*.c -c SBAY     # make all C source files MacShell Files
  306. #
  307. #    shutdown    - shutdown the Macintosh
  308. #
  309. restart                    # call Mac shutdown manager with shutdown request
  310. #
  311. #    sound        - set sound volume
  312. #
  313. sound 0                    # turn sound off
  314. sound 7                    # set sound volume at maximum
  315. sound 7 -s                # set sound to maximum, do not play example sound
  316. #
  317. #
  318. ############    MacShell™ Macintosh DevelopmentCommands ############
  319. #
  320. #
  321. #    dpb            - print directory ParamBlockRec information
  322. #
  323. dpb                        # print ParamBlockRec info for present directory
  324. dpb mydir                # print ParamBlockRec info for directory 'mydir'
  325. #
  326. #    environ        - print information about system environment
  327. #
  328. environ                    # print Macintosh information
  329. #
  330. #    fpb            - print file ParamBlockRec information
  331. #
  332. fpb *.c                    # print ParamBlockRec info for C source files
  333. #
  334. #    vpb            - print volume ParamBlockRec information
  335. #
  336. vpb                        # print ParamBlockRec for current volume
  337. vpb //Floppy            # print ParamBlockRec for volume 'Floppy'
  338. #
  339. #
  340.  
  341.  
  342.  
  343.  
  344.  
  345.  
  346.  
  347.  
  348.  
  349.  
  350.  
  351.  
  352.  
  353.  
  354.  
  355.  
  356.  
  357.  
  358.